package com.cn.wanxi.dao.impl;

import com.cn.wanxi.dao.CompanyDao;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.util.JDBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class CompanyDaoImpl implements CompanyDao {
    @Override
    public CompanyModel findFrontCompanyModel() {
        String sql="select * from company where is_show=1";
        CompanyModel companyModel=new CompanyModel();
        ResultSet resultSet= JDBC.query(sql,new ArrayList());
        try {
            while (resultSet.next()){
                companyModel.setLogo(resultSet.getString("logo"));
                companyModel.setPhone(resultSet.getString("phone"));
                companyModel.setAddress(resultSet.getString("address"));
                companyModel.setNet(resultSet.getString("net"));
                companyModel.setEmail(resultSet.getString("email"));
                companyModel.setLinePhone(resultSet.getString("line_phone"));
                companyModel.setVersion(resultSet.getString("version"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return companyModel;
    }

    @Override
    public int add(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int update(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int delete(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public List<CompanyModel> findAll(CompanyModel companyModel) {
        return null;
    }

    @Override
    public CompanyModel findById(CompanyModel companyModel) {
        return null;
    }

    @Override
    public int getCount(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int changeEnable(CompanyModel companyModel) {
        return 0;
    }
}
